package com.heisen.system.controller;


import com.heisen.base.entity.Api;
import com.heisen.database.controller.AbstractController;
import com.heisen.database.service.ISuperService;
import com.heisen.system.dto.MenuDto;
import com.heisen.system.entity.Menu;
import com.heisen.system.query.MenuQuery;
import com.heisen.system.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 菜单表 前端控制器
 * </p>
 *
 * @author sen
 * @since 2023-12-24
 */
@RestController
@RequestMapping("/menu")
public class MenuController  extends AbstractController<Menu, MenuDto, MenuQuery, IMenuService> {

    /**
     * 获取动态路由
     * @param username
     * @return
     */
    @GetMapping("/routerVueMeta")
    public Api routerVueMeta(String username){
        return Api.ok( service.getUserRouters(username));
    }

    /**
     *  获取所有树状菜单 加按钮
     */
    @GetMapping("/findMetaView")
    public Api findMetaView(String username){
        return Api.ok( service.findMetaView(username , null));
    }

    /**
     *  获取树状菜单
     */
    @GetMapping("/findTreeMeta")
    public Api findTreeMeta(String username){
        return Api.ok( service.findTreeMeta(username));
    }






}
